package com.study.living;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * bean
 *
 * @author chenhs
 * @date 2019/9/1
 */
public class Test {
	private String xmlPath = "com.study/living/common/applicationContext.xml";
	private ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(xmlPath);
	
	@org.junit.Test
	/*默认构造（不能重写构造方法）*/ public void demo1() {
		BookIServciempl bookServcie = applicationContext.getBean("bookServcieId",BookIServciempl.class);
		bookServcie.addBoook();
		
	}
	
	/*静态工厂*/
	@org.junit.Test
	public void demo2() {
		BookIServciempl bookServcie =(BookIServciempl) applicationContext.getBean("bookServcieFactoryId");
		bookServcie.addBoook();
		
	}
	
}
